package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @Author 王子旭
 * @Date 2025/03/27 21:32
 * @Version 1.0
 */
@Configuration
public class RedissonConfig {
    @Bean
    @Primary
    public RedissonClient redissonClient1() {
        Config config = new Config();
//        config.useSingleServer().setAddress("redis://localhost:6379").setPassword("123456");
        config.useSingleServer().setAddress("redis://localhost:6380");
        return Redisson.create(config);
    }
    @Bean
    public RedissonClient redissonClient2() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://localhost:6381");
        return Redisson.create(config);
    }
    @Bean
    public RedissonClient redissonClient3() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://localhost:6382");
        return Redisson.create(config);
    }
}
